import request from '@/utils/request'

// 导航菜单
export function menuList(query) {
  return request({
    url: '/sys/menu/list',
    method: 'Post',
    data: query
  })
}

// 上级菜单
export function sideMenuList(data = {}) {
  return request({
    url: '/auth/navigation',
    method: 'get',
    params: data
  })
}

// 上级菜单
export function createMenu(data) {
  return request({
    url: '/sys/menu/create',
    method: 'Post',
    data
  })
}

export function menuDetail(data = {}) {
  return request({
    url: `/sys/menu/${data.id}`,
    method: 'get',
    params: data
  })
}

export function updateMenu(data) {
  return request({
    url: '/sys/menu/update',
    method: 'Post',
    data
  })
}
export function delMenu(data) {
  return request({
    url: `/sys/menu/delete/${data.id}`,
    method: 'post',
    data
  })
}

// 获取部门列表
export function deptList(query) {
  return request({
    url: '/sys/dept/list',
    method: 'Post',
    data: query
  })
}

// 创建部门
export function createDept(data) {
  return request({
    url: '/sys/dept/create',
    method: 'Post',
    data
  })
}
// 更新部门
export function updateDept(data) {
  return request({
    url: '/sys/dept/update',
    method: 'Post',
    data
  })
}

export function deptDetail(data = {}) {
  return request({
    url: `/sys/dept/${data.id}`,
    method: 'get',
    params: data
  })
}
